package com.pgyl.contract.model;

import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;

import java.time.LocalDate;

// 基类：包含公共字段
@JsonTypeInfo(
        use = JsonTypeInfo.Id.NAME,
        include = JsonTypeInfo.As.PROPERTY,
        property = "contractType", // JSON中标识类型的字段名
        visible = true // 是否将类型标识字段保留在反序列化后的对象中
)
@JsonSubTypes({
        @JsonSubTypes.Type(value = SalesContract.class, name = "SALES"),
        @JsonSubTypes.Type(value = PurchaseContract.class, name = "PURCHASE")
})
public abstract class Contract {
    private String contractNumber;
    private LocalDate startDate;
    private LocalDate endDate;
    // 公共字段的getter/setter


    public String getContractNumber() {
        return contractNumber;
    }

    public void setContractNumber(String contractNumber) {
        this.contractNumber = contractNumber;
    }

    public LocalDate getStartDate() {
        return startDate;
    }

    public void setStartDate(LocalDate startDate) {
        this.startDate = startDate;
    }

    public LocalDate getEndDate() {
        return endDate;
    }

    public void setEndDate(LocalDate endDate) {
        this.endDate = endDate;
    }
}
